﻿
-- 录像机配置增加
create procedure [dbo].[DVRSet_Add]
@MyKey varchar(50),
@MyValue varchar(50),
@Type bit
as
if not exists (select 1 from DVR_Set where MyKey=@MyKey or (@Type=0 and [type]=0))
begin
insert into DVR_Set values(@MyKey,@MyValue,@Type)
end
else
begin
	if (@type=0) -- 用户名
	begin
		delete from DVR_Set where [type]=0
		insert into DVR_Set values(@MyKey,@MyValue,@Type)
	end
	else
	begin
		update DVR_Set set MyValue=@MyValue where MyKey=@MyKey
	end
end